<?php
namespace app\model;

class AbnormalRecord extends Base {
    protected $resultSetType = 'collection';
    public static $STATUS_MAP = ['-1' => '处理中','1' => '用户已处理','2'=> '通过','3' => '驳回','9' => '取消'];

    public function abConfig(){
        return $this->hasOne('AbnormalConfig','id','type')->field('id,name');
    }

    public function getStatusTextAttr($value,$data) {
        $status = self::$STATUS_MAP;
        return isset($status[$data['status']])?$status[$data['status']]:'未知';
    }

    public function getaddTimeAttr($value) {
        return $value ? date("Y-m-d H:i:s", $value) : '';
    }
}
